<?php include _include(ADMIN_PATH.'view/htm/header.inc.htm');?>

<?php $forumselect1 = form_options($forumarr, 0); ?>
<?php $forumselect2 = $forumselect1; ?>

<!--{hook admin_forum_merge_start.htm}-->

<div class="row">
	<div class="col-lg-10 mx-auto">
		<div class="card">
			<div class="card-body">
				<form action="<?php echo url("plugin-setting-xn_forum_merge");?>" method="post" id="form">
					<h4 class="card-title">版块合并</h4>
					<div class="form-group row">
						<label class="col-sm-2 form-control-label">版块一：<span class="text-success font-weight-bold">（保留）</span></label>
						<div class="col-sm-10">
							<select class="custom-select mr-2" name="fid1">
								<?php echo $forumselect1;?>
							</select>
						</div>
					</div>
					<!--{hook admin_forum_merge_forum1_after.htm}-->
					<hr />
					<div class="form-group row">
						<label class="col-sm-2 form-control-label">版块二：<span class="text-danger font-weight-bold">（删除）</span></label>
						<div class="col-sm-10">
							<select class="custom-select mr-2" name="fid2">
								<?php echo $forumselect2;?>
							</select>
						</div>
					</div>
					<!--{hook admin_forum_merge_forum2_after.htm}-->
					<div class="form-group row">
						<label class="col-sm-2 form-control-label"></label>
						<div class="col-sm-10">
							<button type="submit" class="btn btn-primary btn-block" id="submit" data-loading-text="<?php echo lang('submiting');?>..."><?php echo lang('confirm');?></button>
							<a role="button" class="btn btn-secondary btn-block mt-3" href="javascript:history.back();"><?php echo lang('back');?></a>
						</div>
					</div>
					<!--{hook admin_forum_merge_submit_after.htm}-->
				</form>
			</div>
			<p class="m-a-1 small">注：本操作影响的数据比较多，请谨慎使用合并版块操作。</p>
		</div>
	</div>
</div>

<!--{hook admin_forum_merge_end.htm}-->

<?php include _include(ADMIN_PATH.'view/htm/footer.inc.htm');?>

<script>

var jform = $("#form");
var jsubmit = $("#submit");
jform.on('submit', function(){
	if(!window.confirm('确定合并吗？')) return;
	jform.reset();
	jsubmit.button('loading');
	var postdata = jform.serialize();
	$.xpost(jform.attr('action'), postdata, function(code, message) {
		if(code == 0) {
			$.alert(message);
			jsubmit.text(message).delay(2000).button('reset').delay(500).location();
			return;
		} else if(code < 0) {
			$.alert(message);
			jsubmit.button('reset');
		} else {
			jform.find('[name="'+code+'"]').alert(message).focus();
			jsubmit.button('reset');
		}
	});
	return false;
});

</script>

<!--{hook admin_forum_merge_js.htm}-->
